home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-12-10 | 3.7 KB | 131 lines | [TEXT/ALFA] |
- # First basic initialisation:
- if [catch {
- # Get Alpha's current name.
- regexp {"([^"]+)" "ALFA" } [processes] "" ALPHA
- # PREFS points to a folder 'Alpha', we add the major version number
- set alpha::version [lindex [split [version] ,] 0]
- append PREFS "-v[lindex [split ${alpha::version} .] 0]"
- # check if the user over-rides things
- if {[file exists ${HOME}:AlphaPrefs] && [file isdir ${HOME}:AlphaPrefs]} {
- set PREFS ${HOME}:AlphaPrefs
- } else {
- if {[info tclversion] < 8.0} {
- if ![file exists $PREFS] { oldMkdir [list $PREFS] }
- } else {
- if ![file exists $PREFS] { file mkdir $PREFS }
- }
- }
- # source v. important code
- source "$HOME:Tcl:SystemCode:library.tcl"
- alpha::makeAutoPath 0 $skipPrefs
- alpha::fixCoreBugs
- # get known packages
- catch {cache::read index::extension}
- if {![cache::exists index::mode] \
- || ([alpha::package versions Alpha] != ${alpha::version})} {
- alertnote "I need to rebuild the package indices.\
- This'll take just a few seconds."
- alpha::makeIndices
- }
-
- if {![alpha::package vsatisfies ${alpha::version} 7.0d1]} {
- alertnote "This version of Alpha is too old. Upgrade from http://www.cs.umd.edu/~keleher/alpha.html\r\rI'll quit now."
- quit
- }
- # load the list of active packages from special cache
- if {!$skipPrefs} {set package::loaded [cache::snippetRead activepackages]}
-
- # Now do all the more complex stuff:
- # (from now on, avoid use of 'source'. Prefer to use auto-loading)
-
- set alpha::noMenusYet 1
- # pull in smarterSource package if the user activated it
- if {[lsearch -exact ${package::loaded} smarterSource] != -1} {
- alpha::package require smarterSource
- }
-
- removeTemporaryFiles
- alpha::getGlobalPreferences
- alpha::getDefinitions
- if {!$skipPrefs} {
- # Read both scalar and array definitions from preferences folder.
- alpha::readUserDefs
- if [key::optionPressed] {
- }
- }
- # define v. important keyboard variables
- keys::keyboardChanged
- menu::buildBasic
- if ![info exists alpha::haveBasicKeys] {
- alpha::basicKeyBindings
- }
- alpha::keyBindings
- alpha::useElectricTemplates
- # Read in all packages, modes and menus.
- alpha::findAllPlugins
- if {!$skipPrefs} {
- # read preferences file
- if [catch {alpha::readUserPrefs} err] {
- append alpha::errorLog "\r" $err
- unset err
- }
- }
- # call anything that's attached to my keyboard.
- hook::callAll keyboard $keyboard
- # build all menus completely.
- alpha::buildMainMenus
- # insert menus
- global::insertAllMenus
- # adjust enabled status of menus
- catch {endisableMenus}
- # bind special keys
- bind::fromArray keys::specialBindings keys::specialProcs
-
- # if we do anything else to a menu, it must now be rebuilt
- unset alpha::noMenusYet
-
- # couple of random things
- alpha::makeColourList
-
- # Add to chars considered part of words.
- addAlphaChars {_ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüÅØæøæß}
- # Call all startup hooks
- hook::callAll startupHook *
- # call these two procs to sort out the menu enabled state.
- menuEnableHook 0
- requireOpenWindowsHook 2
-
- # Alerts and readme's for the user:
-
- if {!$skipPrefs} {
- if {![info exists readReadme] \
- || ($readReadme != [alpha::package versions Alpha])} {
- addDef readReadme [alpha::package versions Alpha]
- edit -r "$HOME:Help:Readme"
- } else {unset readReadme}
-
- if {[info exists alpha::readAtStartup]} {
- foreach f ${alpha::readAtStartup} {
- catch {edit -r $f}
- }
- unset alpha::readAtStartup
- lappend modifiedVars alpha::readAtStartup
- }
- }
-
- } err] {
- append alpha::errorLog "\r" $errorInfo
- alertnote "That was a core startup error. Alpha will probably not function correctly."
- }
- if [info exists alpha::errorLog] {
- new -n "* Alpha startup error log *"
- insertText ${alpha::errorLog}
- unset alpha::errorLog
- winReadOnly
- }
-
- message "Initialization Complete"
-
-
-
-